GList *windows;
gboolean register_session;
+ gboolean quit_requested;
#ifdef GDK_WINDOWING_X11
GDBusConnection *session_bus;
GMenu *combined;
AppleEvent quit_event, quit_reply;
- gboolean quit_requested, quitting;
+ gboolean quitting;
#endif
};
return menubar;
}
+#if defined(GDK_WINDOWING_X11)
+
/* D-Bus Session Management
*
* The protocol and the D-Bus API are described here:
* http://people.gnome.org/~mccann/gnome-session/docs/gnome-session.html
*/
-#ifdef GDK_WINDOWING_X11
-
-/**
- * GtkApplicationInhibitFlags:
- * @GTK_APPLICATION_INHIBIT_LOGOUT: Inhibit logging out (including shutdown
- * of the computer)
- * @GTK_APPLICATION_INHIBIT_SWITCH: Inhibit user switching
- * @GTK_APPLICATION_INHIBIT_SUSPEND: Inhibit suspending the
- * session or computer
- * @GTK_APPLICATION_INHIBIT_IDLE: Inhibit the session being
- * marked as idle (and possibly locked)
- *
- * Types of user actions that may be blocked by gtk_application_inhibit().
- *
- * Since: 3.4
- */
-
static void
unregister_client (GtkApplication *app)
{
if (strcmp (signal_name, "QueryEndSession") == 0)
{
g_debug ("Received QueryEndSession");
+ app->priv->quit_requested = TRUE;
g_signal_emit (app, gtk_application_signals[QUIT_REQUESTED], 0);
}
else if (strcmp (signal_name, "EndSession") == 0)
g_return_if_fail (GTK_IS_APPLICATION (application));
g_return_if_fail (!g_application_get_is_remote (G_APPLICATION (application)));
g_return_if_fail (application->priv->client_proxy != NULL);
+ g_return_if_fail (application->priv->quit_requested);
+
+ application->priv->quit_requested = FALSE;
g_debug ("Calling EndSessionResponse %d '%s'", will_quit, reason);
NULL, NULL, NULL);
}
+/**
+ * GtkApplicationInhibitFlags:
+ * @GTK_APPLICATION_INHIBIT_LOGOUT: Inhibit logging out (including shutdown
+ * of the computer)
+ * @GTK_APPLICATION_INHIBIT_SWITCH: Inhibit user switching
+ * @GTK_APPLICATION_INHIBIT_SUSPEND: Inhibit suspending the
+ * session or computer
+ * @GTK_APPLICATION_INHIBIT_IDLE: Inhibit the session being
+ * marked as idle (and possibly locked)
+ *
+ * Types of user actions that may be blocked by gtk_application_inhibit().
+ *
+ * Since: 3.4
+ */
+
/**
* gtk_application_inhibit:
* @application: the #GApplication